package com.gxa.controller.xiaohuocontroller;

import com.gxa.common.R;
import com.gxa.pojo.*;
import com.gxa.service.xiaohuoservice.KeHuDingDanService;
import io.swagger.annotations.*;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;

/**
 * @version 1.0
 * @Author fluoxetine
 * @Date 2022/3/31 10:42
 **/
@RestController
@RequestMapping("/XiaoHuo/keHuDingDan")
@Api(value = "销货管理" , tags = "客户订单数据接口API")
@RequiresPermissions("客户订单")
public class KeHuDingDanController {
    @Autowired
    private KeHuDingDanService keHuDingDanService;

     @RequestMapping(value = "/selectKeHu",method = RequestMethod.GET)
     @ApiOperation(value = "客户订单客户查询接口" ,notes = "提供当前页码数与每页显示条数",httpMethod = "get",response = R.class)
     @ApiImplicitParams({
             @ApiImplicitParam(name = "keHuType",value = "客户类别",required = false,dataType = "String",paramType = "query"),
             @ApiImplicitParam(name = "keHuBianHao",value = "客户编号",required = false,dataType = "String",paramType = "query"),
             @ApiImplicitParam(name = "page",value = "当前页码数",required = true,dataType = "String",paramType = "query"),
             @ApiImplicitParam(name = "size",value = "每页显示条数", required = true,dataType = "String",paramType = "query")
     })
     @ApiResponses({
             @ApiResponse(code=200,message = "请求成功"),
             @ApiResponse(code=404,message = "找不到页面"),
             @ApiResponse(code=500,message = "后台服务器错误")
     })
     public R selectKeHu(String keHuType,String keHuBianHao){

         return keHuDingDanService.selectKeHu(keHuType, keHuBianHao);
     }

     @RequestMapping(value = "/selectShangPin",method = RequestMethod.GET)
     @ApiOperation(value = "客户订单商品查询接口" ,notes = "提供当前页码数与每页显示条数",httpMethod = "get",response = R.class)
     @ApiImplicitParams({
             @ApiImplicitParam(name = "shangPinBianHao",value = "客户类别",required = false,dataType = "String",paramType = "query"),
             @ApiImplicitParam(name = "page",value = "当前页码数",required = true,dataType = "String",paramType = "query"),
             @ApiImplicitParam(name = "size",value = "每页显示条数", required = true,dataType = "String",paramType = "query")
     })
     @ApiResponses({
             @ApiResponse(code=200,message = "请求成功"),
             @ApiResponse(code=404,message = "找不到页面"),
             @ApiResponse(code=500,message = "后台服务器错误")
     })
    public R selectShangPin(String shangPinBianHao, String shangPinMingCheng, String guiGeXingHao ,String page, String size){

         return keHuDingDanService.selectShangPin( shangPinBianHao,shangPinMingCheng, guiGeXingHao, page,size);
     }

     @RequestMapping(value = "/selectCangKu",method = RequestMethod.GET)
     @ApiOperation(value = "客户订单仓库查询接口",notes = "提供当前页码数与每页显示条数",httpMethod = "get",response = R.class)
     @ApiImplicitParams({
             @ApiImplicitParam(name = "CangKuName",value = "仓库名称",required = false,dataType = "String",paramType = "query"),
     })
     @ApiResponses({
             @ApiResponse(code=200,message = "请求成功"),
             @ApiResponse(code=404,message = "找不到页面"),
             @ApiResponse(code=500,message = "后台服务器错误")
     })
    public R selectCangKu(String CangKuName){
         return keHuDingDanService.selectCangKu(CangKuName);
     }


    /**
     * 新增客户订单
     */
    @PostMapping("/addKeHuDingDan")
    @ApiOperation(value="新增客户订单接口",notes="提供订单信息",httpMethod = "post",response = R.class)
    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public R addKeHuDingDan(@RequestBody KeHuDingDan keHuDingDan){
        return keHuDingDanService.addKeHuDingDan(keHuDingDan);
    }

    @RequestMapping(value = "/addShenHe",method = RequestMethod.POST)
    @ApiOperation(value = "添加客户订单审核接口",notes = "提供当前页码数与每页显示条数",httpMethod = "post",response = R.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "shenHeZhuangTai", value = "审核状态", required = true, dataType = "int", paramType = "query")

    })
    @ApiResponses({
            @ApiResponse(code=200,message = "请求成功"),
            @ApiResponse(code=404,message = "找不到页面"),
            @ApiResponse(code=500,message = "后台服务器错误")
    })
    public R addShenHe(@RequestParam int  shenHeZhuangTai){
        return keHuDingDanService.addShenHe(shenHeZhuangTai);
    }

    @RequestMapping(value = "/fanShenHe", method = RequestMethod.POST)
    @ApiOperation(value = "客户订单反审核接口", notes = "提供当前页码数与每页显示条数", httpMethod = "post", response = R.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "shenHeZhuangTai", value = "审核状态", required = true, dataType = "int", paramType = "query"),
    })
    @ApiResponses({
            @ApiResponse(code = 200, message = "请求成功"),
            @ApiResponse(code = 404, message = "找不到页面"),
            @ApiResponse(code = 500, message = "后台服务器错误")
    })
    public R fanShenHe(@RequestParam int  shenHeZhuangTai) {
        return keHuDingDanService.fanShenHe(shenHeZhuangTai);
    }

}
